<?php include 'header.php'; ?>
	<script>
	$(document).ready(function() {
	
	//if submit button is clicked
	$('#submit').click(function () {		
	
	
		
		//Get the data from all the fields
		var Title = $('input[name=Title]');
		var FirstName = $('input[name=FirstName]');
		var LastName = $('input[name=LastName]');
		var DOB = $('input[name=DOB]');
		var StreetAddress = $('input[name=StreetAddress]');
		var City = $('input[name=City]');
		var StateOrProvince = $('input[name=StateOrProvince]');
		var ZIP = $('input[name=ZIP]');
		var HomePhone = $('input[name=HomePhone]');
		var MobilePhone = $('input[name=MobilePhone]');
		var EmailAddress = $('input[name=EmailAddress]');
		var Password = $('input[name=Password]');
		var PasswordConfirm = $('input[name=PasswordConfirm]');

		
		
		//organize the data properly
		var data = 'Title=' + Title.val() + '&FirstName=' + FirstName.val() + '&LastName=' + LastName.val() + '&DOB=' + DOB.val() + '&StreetAddress=' + StreetAddress.val() + '&City=' + City.val()
		+ '&StateOrProvince=' + StateOrProvince.val() + '&ZIP=' + ZIP.val() + '&HomePhone=' + HomePhone.val() + '&MobilePhone=' + MobilePhone.val() + '&EmailAddress=' + EmailAddress.val() + '&Password=' + Password.val() + '&PasswordConfirm=' + PasswordConfirm.val();
		
		//disabled all the text fields
		$('.text').attr('disabled','true');
		
		//show the loading sign
		$('.loading').show();
		
		//start the ajax
		$.ajax({
			url: "db/ProcessGuestRegistration.php",	
			
			type: "POST",
			dataType: "xml",
			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (xml) {				
				//if process.php returned 1/true (send mail success)
				if (data = $('result',xml).text())
				$("#regform").html("<div class='well'>You have been registered successfully</div>");
				else {
				var data = $('error',xml).text();
				alert(data);
				}
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	
});	
	</script><div id="regform">
	<h1>Guest Registration</h1>
	<div id="regform">
	    <form class="form-horizontal" method="post" action="/hotel_reservations/ProcessGuestRegistration.php" id="register_form">
		
	<div class="control-group">
	<label class="control-label" for="inputTitle">Title</label>
    <div class="controls">
	<input class="span3" type="text" required>   
	</div>
    </div>
		
    <div class="control-group">
	<label class="control-label" for="inputFirstName">First Name</label>
    <div class="controls">
	<input class="span3" type="name" required>  
    </div>
    </div>
	
	<div class="control-group">
    <label class="control-label" for="inputLastName">Last Name</label>
    <div class="controls">
    <input class="span3" type="name" required>  
    </div>
	</div>

	
	<div class="control-group">
	<label class="control-label" for="inputHomePhone"> Home Phone</label>
	<div class="controls">
    <input type = "tel" 
    pattern = "\(\d{3}\) +\d{3}-\d{4}" required /> 
    (###)###-####
	</div>
	</div>
	
	<div class="control-group">
	<label class="control-label" for="inputMobilePhone"> Mobile Phone</label>
	<div class="controls">
    <input type = "tel" 
    pattern = "\(\d{3}\) +\d{3}-\d{4}"  /> 
    (###)###-####
	</div>
	</div>
	
	<div class="control-group">
    <label class="control-label" for="inputAddres">Address</label>
    <div class="controls">
	<input class="span3" type="address" required>  
    </div>
	</div>
	
	<div class="control-group">
    <label class="control-label" for="inputcity">City</label>
    <div class="controls">
	<input class="span3" type="city" required>  
    </div>
	</div>
	
	<div class="control-group">
    <label class="control-label" for="inputZip">Zip Code</label>
    <div class="controls">
	<input class="span3" type="Zip" required>  
	</div>
	</div>
	
	<div class="control-group">
    <label class="control-label" for="inputEmail">Email</label>
	<div class="controls">
    <input class="span3" type="email" required>  
	</div>
	</div>
	
	<div class="control-group">
    <label class="control-label" for="inputPassword">Password</label>
	<div class="controls">
    <input class="span3" type="PW" required>  
	</div>
	</div>
	
	<div class="control-group">
    <label class="control-label" for="inputPasswordConfirm">Confirm Password</label>
	<div class="controls">
    <input class="span3" type="PWconfirm" required>  
	</div>
	</div>
    
    <div class="control-group">
    <div class="controls">
    <button type="submit" class="btn">Send Information</button>
    
	</div>
    </div>
	</form>
	</div>
	</div>
	<?php include 'footer.php'; ?>
	
 